import { request } from "../../request/index.js";
import { showModal, showToast, uploadFile, chooseImage, showLoading } from "../../util/AsyncWx.js";

//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    newsList: []
  },
  //事件处理函数
  async onLoad() {
    var userInfo = wx.getStorageSync('userInfo');
    app.globalData.uid = userInfo.id;
  },
  onShow() {
    this.getnewsList();
  },
  async getnewsList() {
    // showLoading({title:"加载中"});
    const result = await request({ url: "/news/getNewsAll" });
    //  wx.hideLoading();
    this.setData({
      newsList: result

    })
  },
  handleImagePreview: function (e) {
    var that = this
    var url = e.currentTarget.dataset.url
    wx.previewImage({
      current: url,
      urls: [url],
    });
  }
})
